Hi !
I make in VSTO C# an plugin to save selected email with a custom name.
Ex: When I take an email from the inbox I save the SenderName from the mailitem.
When I take an email from the sendbox I would like save the name from the MAILTO of the mailitem.
I have try to use the ReceivedByName option of the mailitem, but It stay empty...
How I can extract the name of the sender MAILTO from an already send email to put this name in a string value ?
Actually I use this code to extract the sendername when I work with the inbox and sendbox folder email:
if(selObject isOutlook.MailItem)
{
ObjectselObject = Application.ActiveExplorer().Selection[compteur_selection];
mailItem = (selObject asOutlook.MailItem);
sujet = mailItem.Subject;
sujet = sujet.Replace(":", " ");
sujet = sujet.Replace("/", " ");
// all this var are string format
date_heure = mailItem.ReceivedTime.ToShortDateString();//work greet !
expediteur = mailItem.SenderName; // Work greet!
destinataire_ea = mailItem.ReceivedByName; // this stay empty...
}
SaveFileDialog
save = newSaveFileDialog();
save.FileName = date_heure.ToString() +
"_Nom du projet_EA_"+ destinataire + "_"+ sujet + "_V_"+ initiale_expediteur;
save.DefaultExt = ".msg";
save.Filter = "Format de message Outlook|*.msg";
save.ShowDialog();
mailItem.SaveAs(@save.FileName, Outlook.OlSaveAsType.olMSG);
thank's for your help on this case !
emarck